package com.buanalintas.sandals.pos.entities;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlTransient;

@Entity
@Table(name = "pos_master_supplier_model")
//@NamedQueries({
//    @NamedQuery(name = "PosMasterSupplierModel.findAll", query = "SELECT t FROM PosMasterSupplierModel t"),
//    @NamedQuery(name = "PosMasterSupplierModel.findBySync", query = "SELECT t FROM PosMasterSupplierModel t WHERE t.sync = :sync"),
//    @NamedQuery(name = "PosMasterSupplierModel.findBySupplierModelId", query = "SELECT t FROM PosMasterSupplierModel t WHERE t.supplierModelId = :supplierModelId"),
//    @NamedQuery(name = "PosMasterSupplierModel.findBySupplierModelCode", query = "SELECT t FROM PosMasterSupplierModel t WHERE t.supplierModelCode = :supplierModelCode")})
public class PosMasterSupplierModel implements Serializable {
    @OneToMany(mappedBy = "itemSupplierModelId")
    private Collection<PosMasterItem> posMasterItemCollection;

    private static final long serialVersionUID = 1L;
    @Column(name = "sync")
    private String sync;
    @Id
    @Basic(optional = false)
    @Column(name = "supplier_model_id")
    private Integer supplierModelId;
    @Column(name = "supplier_model_code")
    private String supplierModelCode;
    @JoinColumn(name = "supplier_model_model_id", referencedColumnName = "model_id")
    @ManyToOne
    private PosMasterModel supplierModelModelId;
    @JoinColumn(name = "supplier_model_supplier_id", referencedColumnName = "supplier_id")
    @ManyToOne
    private PosMasterSupplier supplierModelSupplierId;

    public PosMasterSupplierModel() {
    }

    public PosMasterSupplierModel(Integer supplierModelId) {
        this.supplierModelId = supplierModelId;
    }

    public String getSync() {
        return sync;
    }

    public void setSync(String sync) {
        this.sync = sync;
    }

    public String getSupplierModelCode() {
        return supplierModelCode;
    }

    public void setSupplierModelCode(String supplierModelCode) {
        this.supplierModelCode = supplierModelCode;
    }

    public Integer getSupplierModelId() {
        return supplierModelId;
    }

    public void setSupplierModelId(Integer supplierModelId) {
        this.supplierModelId = supplierModelId;
    }

    public PosMasterModel getSupplierModelModelId() {
        return supplierModelModelId;
    }

    public void setSupplierModelModelId(PosMasterModel supplierModelModelId) {
        this.supplierModelModelId = supplierModelModelId;
    }

    public PosMasterSupplier getSupplierModelSupplierId() {
        return supplierModelSupplierId;
    }

    public void setSupplierModelSupplierId(PosMasterSupplier supplierModelSupplierId) {
        this.supplierModelSupplierId = supplierModelSupplierId;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (supplierModelId != null ? supplierModelId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        if (!(object instanceof PosMasterSupplierModel)) {
            return false;
        }
        PosMasterSupplierModel other = (PosMasterSupplierModel) object;
        if ((this.supplierModelId == null && other.supplierModelId != null) || (this.supplierModelId != null && !this.supplierModelId.equals(other.supplierModelId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        //return "com.buanalintas.sandals.pos.entities.PosMasterSupplierModel[supplierModelId=" + supplierModelId + "]";
        return supplierModelCode;
    }

    @XmlTransient
    public Collection<PosMasterItem> getPosMasterItemCollection() {
        return posMasterItemCollection;
    }

    public void setPosMasterItemCollection(Collection<PosMasterItem> posMasterItemCollection) {
        this.posMasterItemCollection = posMasterItemCollection;
    }
}
